package factorytest.iflytek.com.einkiflytekfactorytest.engineer_test;


import android.os.Handler;
import android.os.Looper;
import android.os.Message;

import java.lang.ref.WeakReference;

public final class MyHandler extends Handler {

    private final WeakReference<BaseFragment> reference;

    public MyHandler(BaseFragment item) {
        super(Looper.getMainLooper());
        reference = new WeakReference<>(item);
    }

    @Override
    public void handleMessage(Message msg) {
        BaseFragment item = reference.get();
        if (item == null) {
            return;
        }
        item.handleMessage(msg);
    }
}